/*
    文章请求模块
*/

import request from "@/utils/request";


// import storage from '@/utils/storage'


// const token_s = storage.getToken('user_local_token');
// console.log(token_s);

export const getArticles = params => {
    return request({
        method:'GET',
        url: 'v1_0/articles',
        params
    })
}


/*
    全部单个文章数据
     
*/
export const getArticleById = (article_id) => {
    return request({
        method:'GET',
        url: `v1_0/articles/${article_id}`
    })
}

/*  
    收藏文章
    /app/v1_0/article/collections
*/

export const goCollecting = artId => {
    return request({
        method:'POST',
        url: 'v1_0/article/collections',
        data:{
            target : artId
        }
    })
}


/*  
    取消收藏
      /app/v1_0/article/collections/:target
*/

export const delCollacting = artId => {
    return request({
        method: 'DELETE',
        url: `v1_0/article/collections/${ artId }`
    })
}


/*  
    点赞
    /app/v1_0/article/likings
*/

export const goLikings = artId => {
    return request({
        method:'POST',
        url: 'v1_0/article/likings',
        data:{
            target : artId
        }
    })
}


/*  
    取消点赞
     /app/v1_0/article/likings/:target
*/

export const delLikings = artId => {
    return request({
        method: 'DELETE',
        url: `v1_0/article/likings/${ artId }`
    })
}